home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / ptool.arc / PTOOLENT.PAS < prev    next >
Pascal/Delphi Source File  |  1985-06-06  |  6KB  |  131 lines

  1. Program PTOOLENT;  {Copyright  R D Ostrander
  2.                                Ostrander Data Services
  3.                                5437 Honey Manor Dr
  4.                                Indianapolis  IN  46241
  5.  
  6.      This is a demonstration program for the Turbo Pascal subroutine PTOOLENT
  7.      for intelligent field editting. Address any questions to the author at
  8.      the above address.                                                      }
  9.  
  10. { $ C - } { This parameter is optional - the PTOOLENT subroutine will identify
  11.             and report Ctrl-Break during field editting.                      }
  12.  
  13. {$V-}     { This parameter is necessary in order to pass String parameters
  14.             of other than 80 characters.                                   }
  15.  
  16. Var
  17.  
  18.     Data      : String [80];                { Data to be editted }
  19.     DataI     : Integer     absolute Data;
  20.     DataR     : Real        absolute Data;
  21.     Size      : Integer;                    { Size of Data              }
  22.     Decimals  : Integer;                    { Number of Decimal places  }
  23.     RetCode   : Integer;                    { Return Code from PTOOLENT }
  24.     DataType  : Char;                       { Type of data to edit      }
  25.  
  26.  
  27. {$I PTOOLENT.INC}  {Include statement for PTOOLENT procedure}
  28.  
  29.  
  30. BEGIN
  31.  
  32.      ClrScr;
  33.      Gotoxy (15,5); Write ('Demonstration of PTOOLENT procedure.');
  34.      Gotoxy (15,7); Write ('PTOOLENT and this program are copyrights');
  35.      Gotoxy (15,8); Write ('of R D Ostrander');
  36.      Gotoxy (15,9); Write ('   Ostrander Data Services');
  37.      Gotoxy (15,10); Write ('   5437 Honey Manor Dr');
  38.      Gotoxy (15,11); Write ('   Indianapolis  IN  46241');
  39.      Gotoxy (15,13); Write ('and have been placed in the public domain.');
  40.      Delay (5000);
  41.      ClrScr;
  42.      RetCode := 0;
  43.      DataType := ' ';
  44.      While (DataType <> 'X')                  { Main Program Loop }
  45.        and (RetCode <> 79)   do
  46.            Begin
  47.                 Gotoxy (5, 2);
  48.                 Write ('What type of data would you like to test?  ');
  49.                 Gotoxy (5, 3);
  50.                 Write ('S = String');
  51.                 Gotoxy (5, 4);
  52.                 Write ('I = Integer');
  53.                 Gotoxy (5, 5);
  54.                 Write ('R = Real');
  55.                 Gotoxy (5, 6);
  56.                 Write ('X = Exit');
  57.                 While (DataType <> 'S')           { Get Data Type to Edit }
  58.                   and (DataType <> 'I')
  59.                   and (DataType <> 'R')
  60.                   and (DataType <> 'X') do
  61.                       Begin
  62.                            Gotoxy (47, 2);
  63.                            Read (KBD, DataType);
  64.                            Write (DataType);
  65.                            DataType := UpCase (DataType);
  66.                       End;
  67.                 If DataType <> 'X' then         { If 'X' then stop }
  68.                    Begin
  69.                         Size := 0;
  70.                         Gotoxy (5, 8);
  71.                         Write ('What size display area?      (1 thru 80)');
  72.                         Gotoxy (34, 9);
  73.                         Write ('(Press  End  to Exit)');
  74.                         Gotoxy (30, 8);
  75.                         While ((Size < 1)                { Get Size }
  76. { Note that these 2 }      or  (Size > 80))
  77. { Inquiries use the }     and (RetCode <> 79) do
  78. { PTOOLENT routine! }         PTOOLENT (Size, 'I', 2, 0, RetCode);
  79.                         Gotoxy (5, 11);
  80.                         Decimals := 0;
  81.                         If (DataType = 'R')         { If Real get Decimals }
  82.                        and (RetCode <> 79) then
  83.                            Begin
  84.                                 Write ('How many decimal places? ');
  85.                                 PTOOLENT (Decimals, 'I', 2, 0, RetCode);
  86.                            End
  87.                            else ClrEol;
  88.                         If RetCode <> 79 then
  89.                            Begin
  90.                                 Gotoxy (1, 14);
  91.                                 Write ('Editting area below:');
  92. { Put in some test data }       Case DataType of
  93.                                      'S' : Data  := 'ABCDEF';
  94.                                      'I' : DataI := 12345;
  95.                                      'R' : DataR := 1.23456789;
  96.                                      End; {Case}
  97.                                 Gotoxy (1, 16);
  98.                                 ClrEol;
  99. { Set to Low Video for effect } LowVideo;
  100. { Do the edit }                 PTOOLENT (Data, DataType, Size, Decimals,
  101.                                           RetCode);
  102. { Return to Normal }            NormVideo;
  103.                                 Gotoxy (1, 19);
  104. { Display the results }         Write ('Output is: ');
  105.                                 ClrEol;
  106.                                 Case DataType of
  107.                                      'S' : Write ('(', Data, ')');
  108.                                      'I' : Write ('(', DataI:Size, ')');
  109.                                      'R' : Write ('(', DataR:Size:Decimals,
  110.                                                   ')');
  111.                                      End; {Case}
  112.                                 Gotoxy (1, 20);
  113.                                 ClrEol;
  114.                                 Write ('Data Type is: ', DataType);
  115.                                 Gotoxy (1, 21);
  116.                                 ClrEol;
  117.                                 Write ('Size is: ', Size);
  118.                                 If DataType = 'R' then
  119.                                    Write ('.', Decimals);
  120.                                 Gotoxy (1, 22);
  121.                                 ClrEol;
  122.                                 Write ('Return Code is: ', RetCode);
  123.                                 DataType := ' ';
  124.                                 RetCode := 0;
  125.                            End;
  126.                    End;
  127.  
  128.            End;
  129.      Gotoxy (1,24);
  130. END.
  131.